﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CPPEI.UpdatePackageTool
{
    /// <summary>
    /// OtherInfoControl.xaml 的交互逻辑
    /// </summary>
    public partial class OtherInfoControl : System.Windows.Controls.UserControl
    {
        private ContentControl _tabItem;
        private Product _product;
        public static OperateControl _operateControl;
        public static Dictionary<string, System.Windows.Controls.UserControl> _otherInfoControlDictionary;
        public OtherInfoControl()
        {
            InitializeComponent();
        }


        public OtherInfoControl(ContentControl tabItem, Product product)
        {
            _otherInfoControlDictionary = new Dictionary<string, System.Windows.Controls.UserControl>();
            _tabItem = tabItem;
            _product = product;
            InitializeComponent();
        }
        private void _ctlBack_Click(object sender, RoutedEventArgs e)
        {

           List<System.Windows.Controls.UserControl> userControl;
            MainWindow.MainDictionary.TryGetValue(_product.AppType, out userControl);
            if (userControl != null)
            {
                _tabItem.Content = userControl[0];
            }
        }

        private void _ctlNext_Click(object sender, RoutedEventArgs e)
        {
            List<System.Windows.Controls.UserControl> userControl;
            MainWindow.MainDictionary.TryGetValue(_product.AppType, out userControl);
            if (userControl != null)
            {
                _tabItem.Content = userControl[2];
            }
        }

        private void _ctlBtnUpload_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            //openFileDialog.InitialDirectory = lblSavePath.Text;//默认的打开路径
            openFileDialog.RestoreDirectory = true;
            openFileDialog.Filter = " 可执行文件(*.dll)|*.dll|所有文件(*.*)|*.* "; ;
           if(openFileDialog.ShowDialog() == DialogResult.OK)
            {
                foreach (string name in openFileDialog.FileNames)
                {
                    _ctlListViewFiles.Items.Add(name);
                }               
            }
        }
    }
}
